home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / tcsh / dist / RCS / tc.os.h,v < prev   
Encoding:
Text File  |  1992-12-18  |  11.6 KB  |  516 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    jhh:1.1; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     92.12.18.14.43.02;  author jhh;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.01/RCS/tc.os.h,v 3.22 1991/11/26 04:28:26 christos Exp $ */
  26. /*
  27.  * tc.os.h: Shell os dependent defines
  28.  */
  29. /*-
  30.  * Copyright (c) 1980, 1991 The Regents of the University of California.
  31.  * All rights reserved.
  32.  *
  33.  * Redistribution and use in source and binary forms, with or without
  34.  * modification, are permitted provided that the following conditions
  35.  * are met:
  36.  * 1. Redistributions of source code must retain the above copyright
  37.  *    notice, this list of conditions and the following disclaimer.
  38.  * 2. Redistributions in binary form must reproduce the above copyright
  39.  *    notice, this list of conditions and the following disclaimer in the
  40.  *    documentation and/or other materials provided with the distribution.
  41.  * 3. All advertising materials mentioning features or use of this software
  42.  *    must display the following acknowledgement:
  43.  *    This product includes software developed by the University of
  44.  *    California, Berkeley and its contributors.
  45.  * 4. Neither the name of the University nor the names of its contributors
  46.  *    may be used to endorse or promote products derived from this software
  47.  *    without specific prior written permission.
  48.  *
  49.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  50.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  51.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  52.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  53.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  54.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  55.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  56.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  57.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  58.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59.  * SUCH DAMAGE.
  60.  */
  61. #ifndef _h_tc_os
  62. #define _h_tc_os
  63.  
  64. #define NEEDstrerror        /* Too hard to find which systems have it */
  65.  
  66. #if SVID > 3
  67. /*
  68.  * for SVR4 we fork pipelines backwards. 
  69.  * more info in sh.sem.c
  70.  */
  71. # define BACKPIPE
  72. #endif /* SVID > 3 */
  73.  
  74. #ifdef OREO
  75. # include <sys/time.h>
  76. # include <sys/resource.h>
  77. # ifdef POSIX
  78. #  ifdef T_BREAK
  79. #   undef T_BREAK
  80. #  endif /* T_BREAK */
  81. #  include <sys/tty.h>
  82. #  include <termios.h>
  83. # endif /* POSIX */
  84. #endif /* OREO */
  85.  
  86. #ifndef NCARGS
  87. # ifdef ARG_MAX
  88. #  define NCARGS ARG_MAX
  89. # else
  90. #  ifdef _MINIX
  91. #   define NCARGS 80
  92. #  else /* !_MINIX */
  93. #   define NCARGS 1024
  94. #  endif /* _MINIX */
  95. # endif /* ARG_MAX */
  96. #endif /* NCARGS */
  97.  
  98. #ifdef titan
  99. extern int end;
  100. #endif /* titan */
  101.  
  102. #ifdef hpux
  103. # ifdef lint
  104. /*
  105.  * Hpux defines struct ucred, in <sys/user.h>, but if I include that
  106.  * then I need to include the *world*
  107.  * [all this to pass lint cleanly!!!]
  108.  * so I define struct ucred here...
  109.  */
  110. struct ucred {
  111.     int     foo;
  112. };
  113. # endif /* lint */
  114.  
  115. /*
  116.  * hpux 7.0 does not define it
  117.  */
  118. # ifndef CSUSP
  119. #  define CSUSP 032
  120. # endif    /* CSUSP */
  121.  
  122. # ifndef hp9000s500
  123. #  include <sys/bsdtty.h>
  124. # endif
  125.  
  126. # ifndef POSIX
  127. #  ifdef BSDJOBS
  128. #   define getpgrp(a) getpgrp2(a)
  129. #   define setpgrp(a, b) setpgrp2(a, b)
  130. #  endif /* BSDJOBS */
  131. # endif    /* POSIX */
  132. #endif /* hpux */
  133.  
  134. /*
  135.  * ISC does not define CSUSP
  136.  */
  137. #ifdef ISC
  138. # ifndef CSUSP
  139. #  define CSUSP 032
  140. # endif    /* CSUSP */
  141. #endif /* ISC */
  142.  
  143. #ifdef ISC202
  144. # undef TIOCGWINSZ
  145. #endif /* ISC202 */
  146.  
  147. /*
  148.  * XXX: This will be changed soon to 
  149.  * #if (SVID > 0) && defined(TIOCGWINSZ)
  150.  * If that breaks on your machine, let me know.
  151.  */
  152. #if defined(INTEL) || defined(u3b2) || defined (u3b5) || \
  153.     defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) 
  154. #ifdef TIOCGWINSZ
  155. /*
  156.  * for struct winsiz
  157.  */
  158. # include <sys/stream.h>
  159. # include <sys/ptem.h>
  160. #endif /* TIOCGWINSZ */
  161. # ifndef ODT
  162. #  define NEEDgethostname
  163. # endif /* ODT */
  164. #endif /* INTEL || att || isc || sco */
  165.  
  166. #ifdef UNIXPC
  167. # define NEEDgethostname
  168. #endif /* UNIXPC */
  169.  
  170. #ifdef IRIS4D
  171. # include <sys/time.h>
  172. # include <sys/resource.h>
  173. /*
  174.  * BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc.
  175.  */
  176. # define setpgrp BSDsetpgrp
  177. # define getpgrp BSDgetpgrp
  178. #endif /* IRIS4D */
  179.  
  180. /*
  181.  * Stat
  182.  */
  183. #ifdef ISC
  184. /* these are not defined for _POSIX_SOURCE under ISC 2.2 */
  185. # ifndef S_IFMT
  186. #  define S_IFMT  0170000        /* type of file */
  187. #  define S_IFDIR 0040000        /* directory */
  188. #  define S_IFCHR 0020000        /* character special */
  189. #  define S_IFBLK 0060000        /* block special */
  190. #  define S_IFREG 0100000        /* regular */
  191. #  define S_IFIFO 0010000        /* fifo */
  192. #  define S_IFNAM 0050000        /* special named file */
  193. # endif /* S_IFMT */
  194. #endif /* ISC */
  195.  
  196. #ifdef uts
  197. /*
  198.  * The uts 2.1.2 macros (Amdahl) are busted!
  199.  * You should fix <sys/stat.h>, cause other programs will break too!
  200.  *
  201.  * From: creiman@@ncsa.uiuc.edu (Charlie Reiman)
  202.  */
  203. # undef S_ISDIR
  204. # undef S_ISCHR
  205. # undef S_ISBLK
  206. # undef S_ISREG
  207. # undef S_ISFIFO
  208. # undef S_ISNAM
  209. # undef S_ISLNK
  210. # undef S_ISSOCK
  211. #endif /* uts */
  212.  
  213. #ifdef S_IFMT
  214. # if !defined(S_ISDIR) && defined(S_IFDIR)
  215. #  define S_ISDIR(a)    (((a) & S_IFMT) == S_IFDIR)
  216. # endif    /* ! S_ISDIR && S_IFDIR */
  217. # if !defined(S_ISCHR) && defined(S_IFCHR)
  218. #  define S_ISCHR(a)    (((a) & S_IFMT) == S_IFCHR)
  219. # endif /* ! S_ISCHR && S_IFCHR */
  220. # if !defined(S_ISBLK) && defined(S_IFBLK)
  221. #  define S_ISBLK(a)    (((a) & S_IFMT) == S_IFBLK)
  222. # endif    /* ! S_ISBLK && S_IFBLK */
  223. # if !defined(S_ISREG) && defined(S_IFREG)
  224. #  define S_ISREG(a)    (((a) & S_IFMT) == S_IFREG)
  225. # endif    /* ! S_ISREG && S_IFREG */
  226. # if !defined(S_ISFIFO) && defined(S_IFIFO)
  227. #  define S_ISFIFO(a)    (((a) & S_IFMT) == S_IFIFO)
  228. # endif    /* ! S_ISFIFO && S_IFIFO */
  229. # if !defined(S_ISNAM) && defined(S_IFNAM)
  230. #  define S_ISNAM(a)    (((a) & S_IFMT) == S_IFNAM)
  231. # endif    /* ! S_ISNAM && S_IFNAM */
  232. # if !defined(S_ISLNK) && defined(S_IFLNK)
  233. #  define S_ISLNK(a)    (((a) & S_IFMT) == S_IFLNK)
  234. # endif    /* ! S_ISLNK && S_IFLNK */
  235. # if !defined(S_ISSOCK) && defined(S_IFSOCK)
  236. #  define S_ISSOCK(a)    (((a) & S_IFMT) == S_IFSOCK)
  237. # endif    /* ! S_ISSOCK && S_IFSOCK */
  238. #endif /* S_IFMT */
  239.  
  240. #ifndef S_IEXEC
  241. # define S_IEXEC 0000100
  242. #endif /* S_IEXEC */
  243. #ifndef S_IXOTH
  244. # define S_IXOTH (S_IEXEC >> 6)
  245. #endif /* S_IXOTH */
  246. #ifndef S_IXGRP
  247. # define S_IXGRP (S_IEXEC >> 3)
  248. #endif /* S_IXGRP */
  249. #ifndef S_IXUSR
  250. # define S_IXUSR S_IEXEC
  251. #endif /* S_IXUSR */
  252.  
  253. /*
  254.  * Access()
  255.  */
  256. #ifndef F_OK
  257. # define F_OK 0
  258. #endif /* F_OK */
  259. #ifndef X_OK
  260. # define X_OK 1
  261. #endif /* X_OK */
  262. #ifndef W_OK
  263. # define W_OK 2
  264. #endif /* W_OK */
  265. #ifndef R_OK
  266. # define R_OK 4
  267. #endif /* R_OK */
  268.  
  269. /*
  270.  * Open()
  271.  */
  272. #ifndef O_RDONLY
  273. # define O_RDONLY    0
  274. #endif /* O_RDONLY */
  275. #ifndef O_WRONLY
  276. # define O_WRONLY    1
  277. #endif /* O_WRONLY */
  278. #ifndef O_RDWR
  279. # define O_RDWR        2
  280. #endif /* O_RDWR */
  281.  
  282. /*
  283.  * Lseek()
  284.  */
  285. #ifndef L_SET
  286. # ifdef SEEK_SET
  287. #  define L_SET        SEEK_SET
  288. # else
  289. #  define L_SET        0
  290. # endif    /* SEEK_SET */
  291. #endif /* L_SET */
  292. #ifndef L_INCR
  293. # ifdef SEEK_CUR
  294. #  define L_INCR    SEEK_CUR
  295. # else
  296. #  define L_INCR    1
  297. # endif    /* SEEK_CUR */
  298. #endif /* L_INCR */
  299. #ifndef L_XTND
  300. # ifdef SEEK_END
  301. #  define L_XTND    SEEK_END
  302. # else
  303. #  define L_XTND    2
  304. # endif /* SEEK_END */
  305. #endif /* L_XTND */
  306.  
  307. #ifdef _SEQUENT_
  308. # define NEEDgethostname
  309. #endif /* _SEQUENT_ */
  310.  
  311. #if defined(BSD) && defined(POSIXJOBS) 
  312. # define setpgid(pid, pgrp)    setpgrp(pid, pgrp)
  313. #endif /* BSD && POSIXJOBS */
  314.  
  315. #if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS))
  316. # if !defined(_AIX370) && !defined(_AIXPS2)
  317. #  define setpgid(pid, pgrp)    setpgrp(pid, pgrp)
  318. # endif /* !_AIX370 && !_AIXPS2 */
  319. # define NEEDtcgetpgrp
  320. #endif /* BSDJOBS && !(POSIX && POSIXJOBS) */
  321.  
  322. #ifdef RENO 
  323. /*
  324.  * RENO has this broken. It is fixed on 4.4BSD
  325.  */
  326. # define NEEDtcgetpgrp
  327. #endif /* RENO */
  328.  
  329. #ifdef DGUX
  330. # define setpgrp(a, b) setpgrp2(a, b)
  331. # define getpgrp(a) getpgrp2(a)
  332. #endif /* DGUX */
  333.  
  334. #ifdef SXA
  335. # ifndef _BSDX_
  336. /*
  337.  * Only needed in the system V environment.
  338.  */
  339. #  define setrlimit     bsd_setrlimit
  340. #  define getrlimit    bsd_getrlimit
  341. # endif    /* _BSDX_ */
  342. # ifndef NOFILE
  343. #  define    NOFILE    64
  344. # endif    /* NOFILE */
  345. #endif /* SXA */
  346.  
  347. #ifdef _MINIX
  348. # ifndef NOFILE
  349. #  define NOFILE 64
  350. # endif /* NOFILE */
  351. /*
  352.  * Minix does not have these, so...
  353.  */
  354. # define nice(a)        /**/
  355. # define ulimit(a, b)        (0x003fffff)
  356. # define getpgrp()        getpid()
  357. # define gethostname(a, b)    (strncpy((a), "minix") == NULL)
  358. #endif /* _MINIX */
  359.  
  360. #ifndef POSIX
  361. # define mygetpgrp()    getpgrp(0)
  362. #else /* POSIX */
  363. # if defined(BSD) || defined(sun)
  364. #  define mygetpgrp()    getpgrp(0)
  365. # else /* BSD || sun */
  366. #  define mygetpgrp()    getpgrp()
  367. # endif    /* BSD || sun */
  368. #endif /* POSIX */
  369.  
  370.  
  371. #if SVID > 0 && !defined(OREO) && !defined(sgi)
  372. # define NEEDgetwd
  373. #endif /* SVID > 0 && !OREO && !sgi */
  374.  
  375. #ifndef S_IFLNK
  376. # define lstat stat
  377. #endif /* S_IFLNK */
  378.  
  379.  
  380. #if defined(BSDTIMES) && !defined(_SEQUENT_)
  381. typedef struct timeval timeval_t;
  382. #endif /* BSDTIMES && ! _SEQUENT_ */
  383.  
  384. #ifdef NeXT
  385. /*
  386.  * From Tony_Mason@@transarc.com, override NeXT's malloc stuff.
  387.  */
  388. # define malloc tcsh_malloc
  389. # define calloc tcsh_calloc
  390. # define realloc tcsh_realloc
  391. # define free tcsh_free
  392. #endif /* NeXT */
  393.  
  394.  
  395. #if !defined(POSIX) || defined(sun)
  396. extern time_t time();
  397. extern char *getenv();
  398. extern int atoi();
  399. extern char *ttyname();
  400.  
  401. # ifndef hpux
  402. extern int abort();
  403. # ifndef fps500
  404. extern int qsort();
  405. # endif /* fps500 */
  406. # else
  407. extern void abort();
  408. extern void qsort();
  409. # endif
  410. extern void perror();
  411.  
  412. #ifndef NEEDgethostname
  413. extern int gethostname();
  414. #endif
  415.  
  416. # ifdef BSDSIGS
  417. #  if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2)
  418. extern int sigvec();
  419. extern int sigpause();
  420. #  else    /* _AIX370 || MACH || NeXT || _AIXPS2 */
  421. #   if !defined(apollo) || !defined(__STDC__)
  422. # ifndef fps500
  423. extern sigret_t sigvec();
  424. extern void sigpause();
  425. # endif /* fps500 */
  426. #   endif /* !apollo || !__STDC__ */
  427. #  endif /* _AIX370 || MACH || NeXT || _AIXPS2 */
  428. extern sigmask_t sigblock();
  429. extern sigmask_t sigsetmask();
  430. # endif    /* BSDSIGS */
  431.  
  432. # ifndef killpg
  433. extern int killpg();
  434. # endif    /* killpg */
  435.  
  436. # ifndef lstat
  437. extern int lstat();
  438. # endif    /* lstat */
  439.  
  440. #ifdef BSD
  441. extern uid_t getuid(), geteuid();
  442. extern gid_t getgid(), getegid();
  443. #endif /* BSD */
  444.  
  445. # ifdef SYSMALLOC
  446. extern memalign_t malloc();
  447. extern memalign_t realloc();
  448. extern memalign_t calloc();
  449. extern void free();
  450. # endif    /* SYSMALLOC */
  451.  
  452. # ifdef BSDTIMES
  453. extern int getrlimit();
  454. extern int setrlimit();
  455. extern int getrusage();
  456. extern int gettimeofday();
  457. # endif    /* BSDTIMES */
  458.  
  459. # if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT)
  460. extern int strcoll();
  461. # endif
  462.  
  463. # ifdef BSDJOBS
  464. #  ifdef BSDTIMES
  465. extern int wait3();
  466. #  else    /* ! BSDTIMES */
  467. #   if !defined(POSIXJOBS) && !defined(_SEQUENT_)
  468. extern int wait3();
  469. #   else /* POSIXJOBS || _SEQUENT_ */
  470. extern int waitpid();
  471. #   endif /* POSIXJOBS || _SEQUENT_ */
  472. #  endif /* ! BSDTIMES */
  473. # else /* !BSDJOBS */
  474. #  if SVID < 3
  475. extern int ourwait();
  476. #  else    /* SVID >= 3 */
  477. extern int wait();
  478. #  endif /* SVID >= 3 */
  479. # endif    /* ! BSDJOBS */
  480.  
  481. # ifdef BSDNICE
  482. extern int setpriority();
  483. # else /* !BSDNICE */
  484. extern int nice();
  485. # endif    /* !BSDNICE */
  486.  
  487. # ifndef fps500
  488. extern void setpwent();
  489. extern void endpwent();
  490. # endif /* fps500 */
  491.  
  492. #ifndef __STDC__
  493. extern struct passwd *getpwuid(), *getpwnam(), *getpwent();
  494. #ifdef PW_SHADOW
  495. extern struct spwd *getspnam(), *getspent();
  496. #endif /* PW_SHADOW */
  497. #endif /* __STDC__ */
  498.  
  499. # ifndef getwd
  500. extern char *getwd();
  501. # endif    /* getwd */
  502. #else /* POSIX */
  503.  
  504. # if (defined(sun) && !defined(__GNUC__)) || defined(_IBMR2) || defined(_IBMESA)
  505. extern char *getwd();
  506. # endif    /* (sun && ! __GNUC__) || _IBMR2 || _IBMESA */
  507.  
  508. # ifdef SCO
  509. extern char *ttyname();   
  510. # endif /* SCO */
  511.  
  512. #endif /* POSIX */
  513.  
  514. #endif /* _h_tc_os */
  515. @
  516.